package com.yunxi.controller.activiti;

import com.yunxi.activiti.service.ActivitiModelDubboService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value={"/service"})
@Api(tags = "activiti:modelsave", description = "工作流流程图服务接口")
public class ModelSaveRestResource
{
    protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);


//    @Reference(version = "${demo.service.version}",
//            application = "${dubbo.application.id}",
//            registry = "${dubbo.registry.address}",
//            url = "${dubbo.application.url}",
//            check = false,
//            timeout = 10000
//    )
    @Autowired
    private ActivitiModelDubboService activitiModelDubboService;


    @RequestMapping(value={"/model/{modelId}/save"}, method={RequestMethod.PUT})
    @ResponseStatus(HttpStatus.OK)
    public void saveModel(@PathVariable String modelId,
                          @RequestParam("name") String name,
                          @RequestParam("json_xml") String json_xml,
                          @RequestParam("svg_xml") String svg_xml,
                          @RequestParam("description") String description) {
        activitiModelDubboService.saveModel(modelId,name,json_xml,svg_xml,description);

    }
}